import request from '@/utils/request'

// 查询数据源列表
export function listDsSetting(query) {
  return request({
    url: '/codegen/dsSetting/list',
    method: 'get',
    params: query
  })
}

// 查询数据源详细
export function getDsSetting(dsSettingId) {
    return request({
      url: '/codegen/dsSetting/' + dsSettingId,
      method: 'get'
    })
  }

// 新增数据源
export function addDsSetting(data) {
    return request({
      url: '/codegen/dsSetting',
      method: 'post',
      data: data
    })
}

// 修改数据源
export function updateDsSetting(data) {
    return request({
      url: '/codegen/dsSetting',
      method: 'put',
      data: data
    })
  }


// 删除数据源
export function delDsSetting(dsSettingId) {
    return request({
      url: '/codegen/dsSetting/' + dsSettingId,
      method: 'delete'
    })
  }

// 测试数据源
export function testDsSetting(dsSettingId) {
    return request({
      url: '/codegen/dsSetting/test/' + dsSettingId,
      method: 'get'
    })
  }

// 查询数据库下所有表结构
export function listDsTables(dsId) {
  return request({
    url: '/codegen/dsSetting/list/ds/tables/' + dsId,
    method: 'get'
  })
}
